<#include "admin/include/inside_header.ftl" >
<body>
<@t.container title="添加管理员" back="true" >
				<form class="form-horizontal" id="add_form" method="post" role="form">
					<#if bean??>
        				<input type="hidden" id="id" name="id" value="${bean.id}"/>	
					</#if>
					<@t.text title="昵称" id="name" value="${bean.name!''}" />    
					<@t.text title="登录名" id="loginName" value="${bean.loginName!''}" />    
                	<@t.text title="密码" id="password" value="" help="不修改密码，请留空." />
                	<@t.select title="状态" id="state" datas={"1":"正常", "2":"锁定"}  defaultValue="${bean.state}"> </@t.select>  
					<@t.submitBtn/>
                </form>
</@t.container>
<#include  "admin/include/footer.ftl">
 <script type="text/javascript">
     $(function(){
		//提交表单
       	  $('#add_form').validator({
        		theme: 'yellow_right_effect',  //设置theme
        		stopOnError: true, //
        		showOk:false,
        	    fields: {
					"loginName": {
        	            rule: "required;<#if (bean.id=="") >remote[admin/admin/checkLoginNameUni] </#if>",
        	            ok: "",
        	            tip:"请输入登录名，由英文字符，下划线，数字组成",
        	            msg: {
        	            	required: "登录名不可以为空!",
        	            }
        	        },
        	        "name": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写昵称",
        	            msg: {
        	            	required: "昵称不可以为空!",
        	            }
        	        }
        	    }
        	});
		  $('#add_form').on('valid.form', function(e, form){
               $ .axs('admin/admin/add',$(this).serialize());
          });
});
    </script>
	    </body>
    </html>